<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>构造函数创建对象</title>
</head>

<body>
  <script>
    // 场景:能够快速创建多个对象
    // 构造函数首字母要大写
    function Pig(name, age, gender) {
      this.name = name,
        this.age = age,
        this.gender = gender
    }
    const pp = new Pig('张三', 14, '男')
    console.log(pp);
  </script>
</body>

</html>